home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / n_b_v203.zip / HELPLINE.DMO < prev    next >
Text File  |  1996-07-04  |  6KB  |  94 lines

  1. $if 0
  2.     ┌──────────────────────────╖                        PowerBASIC v3.20
  3.  ┌──┤          DASoft          ╟──────────────────────┬──────────────────╖
  4.  │  ├──────────────────────────╢    Copyright 1995    │ DATE: 1995-10-01 ╟─╖
  5.  │  │ FILE NAME   HELPLINE.DMO ║          by          ╘════════════════─ ║ ║
  6.  │  │                          ║  Don Schullian, Jr.                     ║ ║
  7.  │  ╘══════════════════════════╝                                         ║ ║
  8.  │ A license is hereby granted to the holder to use this source code in  ║ ║
  9.  │ any program, commercial or otherwise,  without receiving the express  ║ ║
  10.  │ permission of the copyright holder and without paying any royalties,  ║ ║
  11.  │ as long as this code is not distributed in any compilable format.     ║ ║
  12.  │  IE: source code files, PowerBASIC Unit files, and printed listings   ║ ║
  13.  ╘═╤═════════════════════════════════════════════════════════════════════╝ ║
  14.    │                ....................................                   ║
  15.    ╘═══════════════════════════════════════════════════════════════════════╝
  16. $endif
  17.  
  18. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  19. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  20.  
  21. $STACK 2048
  22. $INCLUDE "DAS-NB01.INC"
  23. $INCLUDE "DAS-NBT1.INC"
  24. %ESC_key = 27
  25.  
  26. COLOR 0, 7, 7
  27. CLS
  28. ? "┌────────────────────────────────────────────────────────────────────────
  29. ? "│  HelpLineSetup ( Row?, Col?, Cols?, Attr? )
  30. ? "│ fHelpLine$     ( Msg$, Justify% )
  31. ? "├────────────────────────────────────────────────────────────────────────
  32. ? "│ Menu items, by definition, must be short and, in most cases, graphic in
  33. ? "│ their meaning. A simple sentence will, usually, make the meaning clear
  34. ? "│ and remove any need to create a whole raft of pop-up help screens.
  35. ? "│ The same goes for input field prompts and other such items.
  36. ? "│ In a small program a single call to HelpLineSetup is usually sufficient
  37. ? "│ as the screen area would never change.
  38. ? "│ fHelpLine$ returns the message area in case it needs to be saved. If
  39. ? "│ Msg$ is NULL then the area is cleared.
  40. ? "│            Justify% = 1 for centering the message
  41. ? "│            Justify% = 2 for right justify
  42. ? "│            ELSE         Msg$ is printed as found
  43. ? "└────────────────────────────────────────────────────────────────────────
  44.                                                         '┌──────────────────
  45. ON TIMER (1) GOSUB CLOCK                                '│ clock ready
  46. MakeTBox 24,  1, 1, 10, 32, 31, 51, 120, 2, TIME$       '│ gettin' fancy
  47. MakeTBox 24, 68, 1, 12, 32, 31, 51, 120, 2, DATE$       '│
  48. MakeTBox 24, 14, 1, 52, 32, 47, 51, 120, 0, ""          '│ prepare message
  49. HelpLineSetup 24, 14, 52, 47                            '│ line & call setup
  50.                                                         '│
  51. DIM M$(5)                                               '│ our 5 messages
  52.   M$(0) = "Press 1 -> 4 to see all the messages"        '│
  53.   M$(1) = "This is message 1, it is centered."          '│
  54.   M$(2) = "This is message 2, it is right-justified."   '│
  55.   M$(3) = "This is message 3, it has no justification." '│
  56.   M$(4) = "Press <»ESC/> to exit this demo."          '│
  57.   M$(5) = " Do you wish to quit?  [«Y ]es [/N ]o"  '│ bail-out Y/N
  58.                                                         '│
  59. M% = 0 : J% = 1                                         '│
  60. DO                                                      '│
  61.   fHelpLine M$(M%), J%                                  '│ pop the message
  62.   G% = fGetKey%                                         '│ get a key-press
  63.   IF G% = %ESC_key THEN                                 '│ <ESC> pressed
  64.     H$ = fHelpLine$( M$(5), 1 )                         '│ save message area
  65.     G% = fGetKey%                                       '│ get another key
  66.     IF (G% <> 78) AND (G% <> 110) THEN EXIT LOOP        '│ auto-out if not N
  67.     TBoxWrite H$                                        '│ restore old msg
  68.     ITERATE                                             '│ loop around
  69.   END IF                                                '│
  70.   SELECT CASE G%                                        '│ set justification
  71.     CASE 50    : J% = 2                                 '│ "2"
  72.     CASE 51    : J% = 0                                 '│ "3"
  73.     CASE ELSE  : J% = 1                                 '│ anything else
  74.   END SELECT                                            '│
  75. LOOP                                                    '│ <ESC> exits loop
  76.                                                         '│
  77. COLOR 7, 0, 0                                           '│
  78. CLS                                                     '│
  79. END                                                     '│ end program
  80. '────────────────────────────────────────────────────────┼───────────────────
  81.                                                         '│
  82. CLOCK:                                                  '│ print time
  83.   Tprint 24, 2, TIME$, 0                                '│
  84. RETURN                                                  '│
  85.                                                         '│
  86. FUNCTION fGetKey% LOCAL PUBLIC                          '│ await key-press
  87.                                                         '│
  88.   ClearKeyboard                                         '│
  89.   TIMER ON                                              '│ clock on here
  90.   WHILE NOT INSTAT : WEND                               '│ nothing happening
  91.   TIMER OFF                                             '│ clock off here
  92.   FUNCTION = CVI( INKEY$ + CHR$(0) )                    '│ RETURN key-press
  93.                                                         '│
  94. END FUNCTION                                            '└───────────────────